<div id="media_gallery">
  <% if !@media.nil? && @media.any? %>
    <% @media.in_groups_of(5, false) do |media_row| %>
      <div class="row">
        <% media_row.each do |media| %>
          <%= render partial: "storytime/dashboard/media/media.html.erb", locals: { media: media } %>
        <% end %>
      </div>
    <% end %>

    <%= paginate @media, remote: true, params: { controller: "dashboard/media",
                                                 action: "index",
                                                 id: nil,
                                                 large_gallery: @large_gallery.nil? ? true : @large_gallery } %>
  <% end %>
</div>
